package net.sparrow.gui.drawing;

import net.sparrow.Sparrow;

public class UtilGui {


	public static SpColor getColorFromCode(char code) {
		int colorCodeOffset = "0123456789abcdefklmnor".indexOf(code);
		if (colorCodeOffset < 0 || colorCodeOffset > 15)
		{
			colorCodeOffset = 15;
		}
		return getColorFromInt(Sparrow.mc().colorCodes()[colorCodeOffset]);
	}

	public static SpColor getColorFromInt(int codeColor) {
		float colorR = (codeColor >> 16) / 255.0F;
		float colorG = (codeColor >> 8 & 255) / 255.0F;
		float colorB = (codeColor & 255) / 255.0F;
		return new SpColor(colorR, colorG, colorB, 1f);
	}



}
